﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace MyHome.Server.PluginBase
{
    /// <summary>
    /// A general plugin
    /// </summary>
    public interface IPlugin
    {
        /// <summary>
        /// Gets or sets the configuration for this plugin.
        /// </summary>
        /// <value>
        /// The configuration to use.
        /// </value>
        IDictionary<string, string> Configuration { get; set; }

        /// <summary>
        /// Gets or sets the unique identifier.
        /// </summary>
        /// <value>
        /// The unique identifier.
        /// </value>
        int Id { get; set; }

        /// <summary>
        /// Gets the type of the plugin.
        /// </summary>
        /// <value>
        /// The type of the plugin.
        /// </value>
        PluginType PluginType { get; }

        /// <summary>
        /// Gets the state of the plugin.
        /// </summary>
        /// <value>
        /// The state.
        /// </value>
        PluginState State { get; }

        /// <summary>
        /// Gets or sets the x coordinate of any visible representation of the plugin.
        /// </summary>
        /// <value>
        /// The x coordinate.
        /// </value>
        int X { get; set; }

        /// <summary>
        /// Gets or sets the y coordinate of any visible representation of the plugin.
        /// </summary>
        /// <value>
        /// The y coordinate.
        /// </value>
        int Y { get; set; }

        /// <summary>
        /// Tries to start this plugin asynchronous.
        /// </summary>
        /// <returns>A value indicating the success of this operation.</returns>
        Task<bool> StartAsync();

        /// <summary>
        /// Tries to stop this plugin asynchronous.
        /// </summary>
        /// <returns>A value indicating the success of this operation.</returns>
        Task<bool> StopAsync();
    }
}